package com.hzj.controller;

import com.alibaba.fastjson.JSONObject;
import com.hzj.service.CmnService;

import com.hzj.service.HospitalService;
import com.hzj.utils.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;


@RestController
@RequestMapping("/consumer/admin/hospital")
@CrossOrigin
public class HosputalController {

    @Autowired
    HospitalService hs;
    @Autowired
    CmnService cs;


    @PostMapping("/list/{page}/{limit}")
    public Result list(@PathVariable int page, @PathVariable int limit, @RequestParam(required = false) Integer provinceCode, @RequestParam(required = false) Integer cityCode,@RequestParam(required = false) String hosname) {

        System.out.println("进入");


        return hs.listPage(page, limit, provinceCode, cityCode,hosname);

    }

    @PostMapping("/test")
    public String test() {
        return "成功";
    }

    @PostMapping("/findByDictCode/{dictCode}")
    public Result findByDictCode(@PathVariable String dictCode) {
        return cs.findByDictCode(dictCode);
    }

    @PostMapping("/findChildData/{id}")
    public Result findChildData(@PathVariable int id) {
        return cs.findChildData(id);
    }

    @PostMapping("/showHospDetail/{id}")
    public Result showHospDetail(@PathVariable int id) {
        return hs.showHospDetail(id);
    }

    @PostMapping("/getDeptList/{hoscode}")
    public Result getDeptList(@PathVariable String hoscode) {
        return hs.getDeptList(hoscode);
    }

    @PostMapping("/getScheduleRule/{page}/{limit}/{hoscode}/{depcode}")
    public Result getScheduleRule(@PathVariable Integer page, @PathVariable Integer limit, @PathVariable String hoscode, @PathVariable Integer depcode) {
        return hs.getScheduleRule(page, limit, hoscode, depcode);
    }

    @PostMapping("/getScheduleDetail/{hoscode}/{depcode}/{workDate}")
    public Result getScheduleDetail(@PathVariable String hoscode, @PathVariable Integer depcode, @PathVariable String workDate) {
        return hs.getScheduleDetail(hoscode, depcode, workDate);
    }
}
